package com.cy.cykh.app.util

import android.content.Context
import android.content.DialogInterface
import android.support.v7.app.AlertDialog
import com.cy.cykh.app.view.fragment.ProgressFragment

/**
 * @author Administrator
 * @FileName
 * @date 2018/12/7 15:17
 */
object AlertDialogManagerUtil {

    private val ok = "确认"
    private val notice = "提示"
    lateinit var mAlertDialog: AlertDialog
    /**
     * 显示Toast
     *
     * @param text
     * ： 显示的内容：传入字符串
     * @param
     * ： 显示的时间
     */
    fun showDialog(mContext: Context, text: String, dialogInterface: DialogInterface.OnClickListener) {
        mAlertDialog = AlertDialog.Builder(mContext).setTitle(notice)
                .setMessage(text).setPositiveButton(ok, dialogInterface).create()
        mAlertDialog.show()
    }

    /**
     * 显示Toast
     *
     * @param text
     * ： 显示的内容，String文件中定义字符串的id
     */
    fun showDialog(mContext: Context, text: Int) {
        mAlertDialog = AlertDialog.Builder(mContext).setTitle(notice)
                .setMessage(text).setPositiveButton(ok) { _, _ -> mAlertDialog.dismiss() }.create()
        mAlertDialog.show()
    }




//    fun showDialog(mContext: Context, text: Int) {
//        mAlertDialog = AlertDialog.Builder(mContext).setTitle(notice)
//                .setMessage(text).setPositiveButton(ok,object :DialogInterface.OnClickListener {
//                    override fun onClick(dialog: DialogInterface?, which: Int) {
//                        mAlertDialog.dismiss()
//                    }
//                }).create()
//        mAlertDialog.show()
//    }
}
